Skip to content

Conversation

@aschackmull
Copy link
Contributor

@aschackmull aschackmull commented Oct 21, 2025

This PR does two things: First, the old C# Guards library is replaced by the newly instantiated shared Guards library. Second, splitting on assertions is removed and replaced by an implication in the Guards library.

Commit-by-commit review is encouraged.

private module ControlFlowInput implements
InputSig<Location, ControlFlow::Node, ControlFlow::BasicBlock>
{
private import csharp as CS

Check warning

Code scanning / CodeQL

Names only differing by case Warning

CS is only different by casing from Cs that is used elsewhere for modules.
private module GuardsInput implements
SharedGuards::InputSig<Location, ControlFlow::Node, ControlFlow::BasicBlock>
{
private import csharp as CS

Check warning

Code scanning / CodeQL

Names only differing by case Warning

CS is only different by casing from Cs that is used elsewhere for modules.
@aschackmull aschackmull force-pushed the csharp/guards-replace branch 2 times, most recently from 6b712ec to 5163620 Compare October 23, 2025 07:32
@aschackmull aschackmull force-pushed the csharp/guards-replace branch 4 times, most recently from fe690df to e1f16df Compare October 28, 2025 13:31
@aschackmull aschackmull force-pushed the csharp/guards-replace branch from e1f16df to 87d89fd Compare October 29, 2025 12:04
@aschackmull aschackmull marked this pull request as ready for review October 29, 2025 14:27
@aschackmull aschackmull requested review from a team as code owners October 29, 2025 14:27
Copilot AI review requested due to automatic review settings October 29, 2025 14:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances exception handling and guard analysis in the QL control flow library. The changes extend exception-like successor types to include exit successors and introduce additional implication steps for better guard reasoning.

Key changes:

  • Extended exception handling to treat exit successors similarly to exception successors
  • Added trivialHasValue predicate to filter out trivial guard conditions
  • Introduced additionalImpliesStep extension point for custom implication logic
  • Updated test expectations to reflect improved null analysis

Reviewed Changes

Copilot reviewed 32 out of 34 changed files in this pull request and generated no comments.

Show a summary per file
File Description
shared/controlflow/codeql/controlflow/Guards.qll Core logic changes: added exceptionLike predicate, trivialHasValue helper, and extension point for implications
csharp/ql/test/query-tests/Nullness/*.expected Updated test expectations showing improved null check detection
csharp/ql/test/query-tests/Nullness/*.ql Simplified test queries to use new APIs
csharp/ql/test/query-tests/Nullness/Forwarding.cs Test case updated with comment about expected false positive
csharp/ql/test/query-tests/Nullness/C.cs Test case made more realistic by adding conditional assignment
csharp/ql/test/library-tests/controlflow/guards/*.ql Removed deprecated test queries
csharp/ql/test/library-tests/controlflow/guards/*.expected Updated expectations for new guard behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aschackmull
Copy link
Contributor Author

Dca looks reasonable, I think. Some new FPs, a few new TPs, and some FP removal.

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! A few questions; also probably run DCA for other languages given the changes to shared code?

@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label Oct 31, 2025
@aschackmull aschackmull merged commit 09378b8 into github:main Oct 31, 2025
51 of 54 checks passed
@aschackmull aschackmull deleted the csharp/guards-replace branch October 31, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants